<%@page import="java.util.Map"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.alphaking.util.DataConvertorUtil"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>生活邦荟后台管理系统</title>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/common/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/admin/css/bootstrap-responsive.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/admin/css/style-responsive.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/admin/css/backstage_common.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/common/css/iconfont.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/admin/css/productList.css" />
</head>
<body>
	<!--顶部  -->
	<jsp:include page="./navbar.jsp"></jsp:include>
	<div class="container-fluid-full">
		<div class="row-fluid">
			<!--侧边栏-->
			<div id="sidebar-left" class="">
				<div class="nav-collapse sidebar-nav"></div>
			</div>
			<!--主要内容-->
			<div class="span10" id="content" style="">
				<div class="row-fluid">
			    <ul class="selected_info form form-horizontal">
						<label class="width-4">ID：</label>
						<li>
							<input class="form-control" id="id" value="${mapArr.blogId }" />
						</li>
						<label class="width-5">标题：</label>
						<li >
							<input class="form-control" id="title" width="200" value="${mapArr.title }"/>
						</li>
						<button class="btn btn-info search">查询</button>
					</ul>
					<table class="table table-striped table-bordered table-hover">
						<tr>
							<th>id</th>
							<th>标题</th>
							<th>创建时间</th>
							<th>发布人</th>
							<th>操作</th>
						</tr>		
						<c:forEach var="item" items="${blogs}"
							varStatus="status">
			
							<tr id="${item.blogId}">
							    <td>${item.blogId}</td>
								<td>${item.title}</td>
								<td>${fn:substring(item.createTime, 0,19)}</td>
								<c:if test="${item.publisher eq 0 }">
									<td>管理员</td>
								</c:if>
								<c:if test="${item.publisher eq 1 }">
									<td>普通用户</td>
								</c:if>
								<td>
									<button class="btn btn-danger update">编辑</button>
									<button class="btn btn-danger delete">删除</button>
								</td>
							</tr>
						</c:forEach>
					</table>
					<c:choose>
						<c:when test="${pagerResult.count<=0}">
							<div align="center">没有数据</div>
						</c:when>
			
						<c:otherwise>
							<div class="page_container">
								<ul class="page">
									<li><a>总记录数：<span>${pagerResult.count}</span>条
									</a></li>
									<li><a class="" id="firstPage"
										onclick="findByPage(${pagerResult.firstPage})">首页</a>
									</li>
									<li><a class="" id="prepage"
										onclick="findByPage(${pagerResult.previousPage})">上一页</a>
									</li>
									<li><a> <select onchange="pageChange(this)">
			
												<c:forEach var="page" items="${pagerResult.pageList}">
													<c:if test="${pagerResult.currentPage==page }">
														<option value="${page}" selected="selected">${page}</option>
													</c:if>
													<c:if test="${pagerResult.currentPage!=page }">
														<option value="${page}">${page}</option>
													</c:if>
													<c:if test=""></c:if>
												</c:forEach>
										</select>
									</a></li>
									<li><a class="" id="nextpage"
										onclick="findByPage(${pagerResult.nextPage})">下一页</a>
									</li>
									<li><a class="" id="lastPage"
										onclick="findByPage(${pagerResult.lastPage})">尾页</a>
									</li>
									<li><a> 总页数：<span>${pagerResult.totalPage}</span>页
									</a></li>
								</ul>
							</div>
			
						</c:otherwise>
					</c:choose>
			
				</div>
			</div>

		</div>
	</div>
	
	<!--隐藏的查询参数  -->
	<input hidden="hidden" value='${mapJson }' id="mapArr">
	
	<input type="text" style="display: none" id="firstPage"
		value='${pagerResult.firstPage }'>
	<input type="text" style="display: none" id="previousPage"
		value='${pagerResult.previousPage }'>		
	<input type="text" style="display: none" id="nextPage"
		value='${pagerResult.nextPage }'>
	<input type="text" style="display: none" id="lastPage"
		value='${pagerResult.lastPage }'>	
	<input type="text" style="display: none" id="currentPage"
		value='${pagerResult.currentPage }'>	
	<input type="text" style="display: none" id="maxPage"
		value='${pagerResult.totalPage }'>	
	<input type="text" style="display: none" id="size"
		value=''>	
			
</body>
<script
	src="<%=request.getContextPath()%>/resources/common/js/jquery-1.9.1.min.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/common/laydate/laydate.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/admin/js/set_date.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/admin/js/admin.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/admin/js/productManage.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/admin/interactive/blogList.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/common/js/common.js"></script>
<script
	src="<%=request.getContextPath()%>/resources/common/js/pager.js"></script>
</html>
